module.exports = function request(config, callback) {
  return new Promise((resolve, reject) => {
    wx.getStorage({
      key: 'token',
      success: (res) => {
        wx.request({
          header: {
            Authorization: 'Bearer ' + res.data,
            // Authorization:
            //   'Bearer ' +
            //   'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyaWQiOjksInBob25lIjoiMTM2OTY4NDA1MjIiLCJpYXQiOjE2MzUyMjg4NzUsImV4cCI6MTYzNTgzMzY3NX0.JxmMOhi5UqTh-9n6Emp4LCcSRL4twfJQPt3PRlnZO50',
          },
          ...config,
          success: (result) => {
            callback && callback(result.data)
            resolve(result.data)
          },
          fail: () => {},
          complete: () => {},
        })
      },
      fail: () => {},
      complete: () => {},
    })
  })
}
